using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Pub_Module_J_MostProduct_v1 : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        /* if (!IsPostBack)
             BindData();
          */

    }
    private void BindData()
    {
        string viewcount = System.Configuration.ConfigurationManager.AppSettings["MostPD"];
        clsWebShop cls = new clsWebShop();
        DataTable dt = null;
        dt = cls.Get_Most_ProductNoneProc(viewcount).Tables[0];
        if (dt.Rows.Count > 0)
        {
            string HTML = "<div id='lofslidecontent46' class='lof46-slidecontent' style='width:172px; height:190px;'>";
            HTML += "<div class='preload'><div></div></div>";
            HTML += "    <div class='lof46-main-outer' style='width:172px; height:190px;'>";
            HTML += " <div onclick='return false' href='' class='lof46-previous'>Previous</div>";
            HTML += "   	<ul class='lof46-main-wapper'>";


            for (int i = 0; i < dt.Rows.Count; i++)
            {
                HTML += "<li>";
                HTML += "<img src='" + ResolveUrl("~/") + dt.Rows[i]["ImgUrl"].ToString() + "' alt=''  height='190px'  />";
                HTML += "<div class='lof46-main-item-desc'>";

                HTML += "<a href='" + ResolveUrl("~/") + "Shopping/Stall/ProductDetail.aspx?PDID=" + dt.Rows[i]["PDID"].ToString() + "'>" + dt.Rows[i]["PDName"].ToString() + "</a>";
                HTML += "  </div>";
                HTML += "</li>";

            }
            HTML += " </ul>  ";
            HTML += " <div onclick='return false' href='' class='lof46-next'>Next</div>";
            HTML += " </div>  ";
            // ltrMaster.Text = HTML;
        }
    }

    protected void dtlThumbnail_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            string imgUrl = DataBinder.Eval(e.Item.DataItem, "ImgUrl").ToString();
            Image imgNews = (Image)e.Item.FindControl("imgNews");
            if (imgUrl != "")
            {
                imgNews.ImageUrl = "~/" + imgUrl;
            }
            else
            {
                imgNews.ImageUrl = "~/Images/Body/Noimages.gif";
            }
        }
    }
}
